import java.awt.Graphics;
import javax.swing.JPanel;

public class Figura4 extends JPanel {

    public void paintComponent( Graphics g)
    {
        super.paintComponent(g);
        
        int anchura = getWidth();
        int altura = getHeight();
        
        int i=0;
        int x2=15;
        
        while(x2<=getWidth()){
            
            g.drawLine(0,x2-15,x2,getHeight());
            g.drawLine(x2-15,getHeight(),getWidth(),altura-15);//altura--
            g.drawLine(getWidth(),altura,anchura-15,0);//anchura--altura--
            g.drawLine(anchura,0,0,x2);
            
            x2+=15;
            altura-=15;
            anchura-=15;
           
            
        }
       
    }
    
}